﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace WPFClient
{
    /// <summary>
    /// MainWindow.xaml 的交互逻辑
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            WPF.WPFNotifyIcon.Init(@"img/b_ico_02.ico");
            this.Closed += new EventHandler(MainWindow_Closed);
        }

        void MainWindow_Closed(object sender, EventArgs e)
        {
            WPF.WPFNotifyIcon.ClearIco();
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            // /WPFClientApi;component/
            WPF.PopWindow.PopInstance("123", "/WPFClient;component/wx_ico.ico", "123");

        }

        private void button2_Click(object sender, RoutedEventArgs e)
        {
            WPF.PopWindow.PopAddContent("\n" + "....");
            WPF.PopWindow.PopAddContent("\n" + "123");
        }
        int cout = 0;
        private void button3_Click(object sender, RoutedEventArgs e)
        {
            if (cout == 5)
                cout = 0;
            string ico = @"img/b_ico_01.ico";
            if (cout == 1)
                ico = @"img/b_ico_02.ico";
            if (cout == 2)
                ico = @"img/b_ico_03.ico";
            if (cout == 3)
                ico = @"img/r_ico_01.ico";
            if (cout == 4)
                ico = @"img/g_ico_01.ico";
            WPF.WPFNotifyIcon.ShowBalIco(WPF.WToolTipIco.Info, "提示", "一些信息！", 4000, ico);
            cout++;
        }

        private void button4_Click(object sender, RoutedEventArgs e)
        {
            if (cout == 5)
                cout = 0;
            string ico = @"img/b_ico_01.ico";
            if (cout == 1)
                ico = @"img/b_ico_02.ico";
            if (cout == 2)
                ico = @"img/b_ico_03.ico";
            if (cout == 3)
                ico = @"img/r_ico_01.ico";
            if (cout == 4)
                ico = @"img/g_ico_01.ico";
            WPF.WPFNotifyIcon.ChangeingIco(ico);
            cout++;
        }
        System.Windows.Threading.DispatcherTimer timer;
        private void button5_Click(object sender, RoutedEventArgs e)
        {
            timer = new System.Windows.Threading.DispatcherTimer();
            timer.Interval = new TimeSpan(0,0,0,0,500);
            timer.Tick += new EventHandler(timer_Tick);
            timer.Start();

        }

        void timer_Tick(object sender, EventArgs e)
        {
            if (cout == 2)
                cout = 0;
            string ico = @"img/b_ico_01.ico";
            if (cout == 1)
                ico = @"img/bg.ico";
            WPF.WPFNotifyIcon.ChangeingIco(ico);
            cout++;
        }
    }
}
